<template>

    <van-search v-model="search" placeholder="请输入搜索关键词" />
    <div v-for="item in searchApiData">
         <van-card  :price="item.goods_price" :title="item.goods_name"
        :thumb="item.goods_big_logo ? item.goods_big_logo : 'https://fastly.jsdelivr.net/npm/@vant/assets/ipad.jpeg'" />
    </div>
   
</template>

<script setup>
import { ref, watch } from 'vue'
import { searchApi } from '@/api/api'
const search = ref('')
const searchApiData = ref([])
watch(search, (val) => {
    console.log('监听数据', val);
    searchApi(search.value).then(res => {
        console.log('搜索数据', res);
        searchApiData.value = res.data.message.goods
    })
})
</script>

<style lang="scss" scoped></style>